<?php
/**
 * Created by PhpStorm.
 * User: xiaojun
 * Date: 15/12/25
 * Time: 下午12:49
 */


function is_login() {
    if(isset($_SESSION['user_login'])){
        return true;
    }else{
        return false;
    }
}

function is_mobile($mobile){
    if(is_numeric($mobile)){
        if(strlen($mobile) == 11) {
            if(in_array(substr($mobile,0,2),['13','14','15','16','17','18','19'])){
                return true;
            }

        }
    }
    return false;
}

function is_password($pwd){
    if(strlen($pwd) > 5 && strlen($pwd) <21) {
        if(preg_match('/^[_0-9a-z]{6,16}$/i',$pwd)){
            return true;
        }
    }
    return false;
}

function is_smsCode($code) {
    if(is_numeric($code)){
        if(strlen($code) == 6) {
            return true;
        }
    }
    return false;
}